package entity

import (
	"time"

	"shqsoft.cn/pasnj/base"

	"github.com/jinzhu/gorm"
)

//INDI_BXBL 零售保险导入
type INDI_BXBL struct {
	ID        int       `gorm:"column:ID;AUTO_INCREMENT;primary_key"`
	YF        string    `gorm:"column:YF"`
	TBRQ      time.Time `gorm:"column:TBRQ"`
	XSZH      string    `gorm:"column:XSZH"`
	BXGS      string    `gorm:"column:BXGS"`
	TBDH      string    `gorm:"column:TBDH"`
	TBRXM     string    `gorm:"column:TBRXM"`
	TBRZJHM   string    `gorm:"column:TBRZJHM"`
	XZMC      string    `gorm:"column:XZMC"`
	XZ        string    `gorm:"column:XZ"`
	SQBF      float32   `gorm:"column:SQBF"`
	BXHTH     string    `gorm:"column:BXHTH"`
	HTSXRQ    time.Time `gorm:"column:HTSXRQ"`
	HZQS      string    `gorm:"column:HZQS"`
	XSR       string    `gorm:"column:XSR"`
	TJR       string    `gorm:"column:TJR"`
	DJ_QJ     string    `gorm:"column:DJ_QJ"`
	SFYT      string    `gorm:"column:SFYT"`
	GMQD      string    `gorm:"column:GMQD"`
	CCBX_RSBX string    `gorm:"column:CCBX_RSBX"`
	LX        string    `gorm:"column:LX"`
	BZ        string    `gorm:"column:BZ"`
	ZSBL      float32   `gorm:"column:ZSBL"`
	ZS        float32   `gorm:"column:ZS"`
	GSJG      string    `gorm:"column:GSJG"`
	XSJE      float32   `gorm:"column:XSJE"`
	ZSJE      float32   `gorm:"column:ZSJE"`
	YJGSR     string    `gorm:"column:YJGSR"`
	DRJG      string    `gorm:"column:DRJG"`
}

//TableName 短贷宝导入
func (INDI_BXBL) TableName() string {
	return "T_INDI_BX_SGBL_DTIP"
}

//BxblAfterImport 导入后执行分户处理
func BxblAfterImport(tx *gorm.DB, params map[string]string) (err error) {
	prams := make([]interface{}, 1)
	prams[0] = params["YF"]
	tx.Exec("EXEC UP_INDI_BX_SGBL_DTIP ?", prams...)
	return nil
}

//INDI_BXBLEF 返回结构体
func INDI_BXBLEF() base.EntityFunc {
	return func() interface{} {
		entity := INDI_BXBL{}
		return &entity
	}
}

//INDI_BXBLESF 返回结构体数组
func INDI_BXBLESF() base.EntitiesFunc {
	return func() interface{} {
		var entities []INDI_BXBL
		return &entities
	}
}

func init() {
	base.DaoPoolObj.Put("INDI_BXBL", base.NewDefaultDao(INDI_BXBLEF(), INDI_BXBLESF(), nil))
	base.SetAfterCallBack("INDI_BXBL", BxblAfterImport)
}
